package com.hg.concurent.demo4;

import java.util.concurrent.*;

/**
 * created by skh on 2019/12/21
 */
public class CallableDemo {
	public static void main(String[] args) throws ExecutionException, InterruptedException {

		FutureTask<Integer> task = new FutureTask<>(new Callable<Integer>() {
			@Override
			public Integer call() throws Exception {
				return 10;
			}
		});
		new Thread(task,"A").start();
		Integer result = task.get();
		System.out.println("result = " + result);
	}
}
